package com.hmall.api.client;


import com.hmall.api.dto.ItemDTO;
import com.hmall.api.dto.OrderDetailDTO;
import io.swagger.annotations.ApiImplicitParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

@FeignClient("item-service")//一个指向item-service的远程调用
public interface ItemClient {
    @GetMapping("/items")//请求类型
    List<ItemDTO> queryItemByIds(@RequestParam("ids") Set<Long> ids);
    //返回类型 地址拼接 参数类型

    @ApiImplicitParam(name = "ids", value = "购物车条目id集合")
    @DeleteMapping
    public void deleteCartItemByIds(@RequestParam("ids") List<Long> ids);

    @PutMapping("/items/stock/deduct")
    public void deductStock(@RequestBody List<OrderDetailDTO> items);

    @PutMapping("/stock/restore")
    public void restoreStock(@RequestBody List<OrderDetailDTO> orderDetailDTOS);

}
